<?php
/**
 * Created by PhpStorm.
 * User: ybjaa
 * Date: 2017/7/20
 * Time: 15:17
 */

namespace App\Business\Article;


use App\Business\BusBase;
use App\Business\ReturnResult;
use App\Models\articles;

class ArticlesList extends BusBase
{
    use ArticleTypeEnum;

    public $type;
    public $condition;

    protected $type_number=0;

    /**
     * 检测参数是否符合要求
     */
    protected function checkParameters()
    {

        if(!$this->type||!array_key_exists(strtolower($this->type),self::$ArrayType)) return ReturnResult::ParameterError(null,"文章类型错误");
        $this->type_number=self::$ArrayType[strtolower($this->type)];

        return ReturnResult::Success();

    }

    protected function Handle()
    {


        $models=articles::where("type",$this->type_number);


        return ReturnResult::Success();


    }

    public function GetBusinessName()
    {
        return "创建文章";
    }


}